package org.akushe.core.config;

import java.util.Properties;



public class Configuration {
	
	private final Properties properties;
	private static Configuration config;
	
    private Configuration()
    {
        // load base properties
        String baseProperties = "application.properties";
        Properties base = PropertyUtils.loadFromClassPath(baseProperties, false);
        properties = base;
        
        // load user-specific property overrides
/*        String username = System.getProperty("user.name");
        String userProperties = "brix/demo/application." + username + ".properties";
        Properties user = PropertyUtils.loadFromClassPath(userProperties, false);

        // load system properties
        Properties system = System.getProperties();

        // merge properties
        properties = PropertyUtils.merge(MergeMode.OVERRIDE_ONLY, base, user, system);*/
    }	 
    public static Configuration getInstance(){
    	if(config == null){
    		config = new Configuration();
    	}
    	return config;
    }

    /**
     * @return jcr login name
     */
    public String getJcrLogin()
    {
        return properties.getProperty("akushe.jcr.login");
    }

    /**
     * @return jcr login password
     */
    public String getJcrPassword()
    {
        return properties.getProperty("akushe.jcr.password");
    }

    /**
     * @return jcr default workspace
     */
    public String getJcrDefaultWorkspace()
    {
        return properties.getProperty("akushe.jcr.defaultWorkspace");
    }
    
    public String getRepositoryHome(){
    	return properties.getProperty("akushe.repository.config.home");
    }
    
    public String getRepositoryConfigFile(){
    	return properties.getProperty("akushe.repository.config.file");
    }
}
